package com.prd.controller;


import com.prd.dto.SysPostDTO;
import com.prd.service.SysPostService;
import com.prd.util.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 部门岗位数据表 前端控制器
 * </p>
 *
 * @author lizhaoyi
 * @since 2024-01-04
 */
@RestController
@RequestMapping("/api/sysPost")
@Api(tags = "部门岗位")
public class SysPostController {

    @Autowired
    private SysPostService sysPostService;

    @ApiOperation("添加职务岗位")
    @PostMapping("add")
    public JsonData add(@RequestBody SysPostDTO sysPostDTO){

        return sysPostService.add(sysPostDTO);
    }

    @ApiOperation("编辑")
    @PostMapping("edit")
    public JsonData edit(@RequestBody SysPostDTO sysPostDTO){

        return sysPostService.edit(sysPostDTO);
    }


    @ApiOperation("移除")
    @PostMapping("deleteByIds")
    public JsonData deleteByIds(@ApiParam("部门职务id") @RequestParam List<String> ids){

        return sysPostService.deleteByIds(ids);
    }

    @ApiOperation("查询职务岗位列表")
    @GetMapping("selectList")
    public JsonData selectList(){

        return sysPostService.selectList();
    }

    @ApiOperation("查询职务岗位")
    @GetMapping("selectOne")
    public JsonData selectOne(@ApiParam("职务岗位id") @RequestParam Long id){

        return sysPostService.selectOne(id);
    }

}

